package com.qf.ts.platform.front.util;


import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Util {
    public static String md5(String source){
        try {
            //获取MD5对象
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            //加密
            md5.update(source.getBytes());
            //返回字符串
            return new BigInteger(md5.digest(source.getBytes())).toString(16);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return null;
        }

    }
}
